package com.example.demo.service.impl;

import com.example.demo.dao.StudentRepository;
import com.example.demo.domain.Student;
import com.example.demo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    StudentRepository studentRepository;

    /*读取学生数据*/
    public List<Student> findAll(){

        return studentRepository.findAll();
    }
    @Override
    
    /*插入学生*/
    public Student insert(Student student){
        return studentRepository.save(student);
    }
    /*更新学生*/
    public Student update(Student student){

        return studentRepository.save(student);
    }
}
